package com.zcx.qshop.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.KeyEvent;
import android.view.ViewGroup;

import com.zcx.helper.bound.BoundViewHelper;
import com.zcx.qshop.QSApplication;
import com.zcx.qshop.R;

/**
 * Created by Administrator on 2015/8/29 0029.
 */
public class QSDialog extends Dialog {

    public QSDialog(Context context) {

        this(context, R.style.YCDialog);

    }

    public QSDialog(Context context, int theme){

        super(context, theme);

        setCanceledOnTouchOutside(true);

        setCancelable(true);

    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {

        if(keyCode == KeyEvent.KEYCODE_BACK){

            dismiss();

        }

        return super.onKeyDown(keyCode, event);

    }

    @Override
    public void setContentView(int layoutResID) {

        super.setContentView(layoutResID);

        BoundViewHelper.boundView(this, QSApplication.ScaleScreenHelper.loadView((ViewGroup) getWindow().getDecorView()));

    }

}
